const userMixin = {
  data() {
    const validatePhone = (rule, value, callback) => {
      if (!(/^\S+$/.test(value))) {
        callback(new Error(''))
      } else if (!(/^1[3456789]\d{9}$/.test(value))) {
        callback(new Error(''))
      } else {
        callback()
      }
    }
    const validateCode = (rule, value, callback) => {
      if (!(/^\S+$/.test(value))) {
        callback(new Error(''))
      } else if (!(/^\d{5}$/.test(value))) {
        callback(new Error(''))
      } else {
        callback()
      }
    }
    return {
      count: 0,
      sendMsg: '获取验证码',
      disabled: false,
      rules: {
        phoneNumber: [{ required: true, validator: validatePhone }],
        code: [{ required: true, validator: validateCode }]
      }
    }
  }
}
export default userMixin
